<template>
<view>
	<view class="header">生日提醒</view>
	<view class="table">
		<table border="0" width="98%" cellspacing="0" cellpadding="0">
			<tr>
				<td>客户名称</td>
				<td>生日</td>
				<td>操作</td>
			</tr>
			<tr v-for="(item,index) in list" :key="index">
				<td>{{item.username}}</td>
				<td>{{item.birthDay}}</td>
				<td @click="send(item.id)">
					<view class="td_botton">发送生日短信</view>
				</td>
			</tr>
		</table>
	</view>
</view>
</template>
<script>
import request from '@/util/request.js'
export default {
	data() {
		return {
			//oaRole 1:店长2:员工3:商户
			oaRole:0,
			list:[],
			pageShow:true,
			page:1
		}
	},
	onLoad:function(){
		uni.showLoading({
		    title: '加载中'  
		});
		this.getList()
		this.oaRole = uni.getStorageSync('oaRole')
	},
	methods: {
		getList:function(){
			var data = {
				page:this.page,
				oa_id:uni.getStorageSync('oa_id')
			}
			var that = this
			request({
				url: 'manage/member/birthday',
				method: 'get',
				data:data,
				success: (res) => {
					uni.hideLoading();
					if(res.data.data.last_page <= that.page){
						that.pageShow = false
					}
					if(that.page == 1){
						that.list = res.data.data.data
					}else{
						var list = that.list
						that.list = list.concat(res.data.data.data)
					}
				},
			})
		},
		onReachBottom: function(){
			if(this.pageShow){
				 //当前不是最后一页可加载
				 this.page = this.page + 1
				 uni.showLoading()
				 this.getList();
			}
		},
		send:function(id){
			uni.showToast({
				title: '请购买短信套餐!!',
				icon: "none", 
				position:'bottom',
			});
			return;
		}
	},
}
</script>
<style>
.header{
    width:100%;
    height:80rpx;
    line-height: 80rpx;
    background:#009900;
	text-align: center;
	color:#FFFFFF;
}
.table{
	width:100%;
	padding:10rpx 10rpx 120rpx 10rpx;
}
table{
	margin-top:30rpx;
}
td{
	border:1rpx solid #C8C7CC;
	text-align: center;
	height:70rpx;
	line-height:70rpx;
}
.td_botton{
	width:200rpx;
	height:50rpx;
	text-align: center;
	line-height: 50rpx;
	background:#009900;
	color:#FFFFFF;
	font-size:14px;
}
</style>